<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.tss.util.*"%>
<%@page import="com.store.*"%>
<%@page import="com.jedi.*"%>
<%@page import="java.util.*"%>
<%@include file="../global_var.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
User just_user = (User)session.getAttribute("LoginUser");
String power_enable_id = "10702";
if (!just_user.hasPower(power_enable_id)) {
	out.println(strNoPowerInfo); 
	return;
}


%>

<%
String comname       = ParamUtils.getParameter(request,"comname","");//厂商名称
String comtel		= ParamUtils.getParameter(request,"comtel","");//厂商电话
String comaddress=ParamUtils.getParameter(request,"comaddress","");//地址
String comremark = ParamUtils.getParameter(request,"comremark","");//备注

String comsalename      = ParamUtils.getParameter(request,"comsalename","");//联系人
String comsaletel   = ParamUtils.getParameter(request,"comsaletel","");//联系人电话
String comsaleremark   = ParamUtils.getParameter(request,"comsaleremark","");//联系人备注
String comsalemail   = ParamUtils.getParameter(request,"comsalemail","");//E-mail

String cmd = ParamUtils.getParameter(request,"cmd","");
String strErr = "";
if (cmd.trim().equals("insert")) {
	if (strErr.trim().equals("") && comname.trim().equals("")) {
		strErr = "厂商名称不能为空!";
	}

	if (strErr.trim().equals("") && ! comsalemail.trim().equals("") ) {
	if(!ParamUtils.isEmail(comsalemail)){
	
	strErr = "E-mail地址输入错误!";
	}
		
	}
if (strErr.trim().equals("")) {


		Company company = new Company();
		company.setComnam(comname);
		company.setComtel(comtel);
		company.setComaddress(comaddress);
		company.setComremark(comremark);
		
			Companysale comsale = new Companysale();
				comsale.setSalename(comsalename);
				comsale.setSalemail(comsalemail);
				comsale.setSaletel(comsaletel);
				comsale.setRemark(comsaleremark);
			
		company.setComsale(comsale);
		company.insert();
		if (company.hasErr()) strErr = company.getErrHtml();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    
<title></title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
   <link href="style/main.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/common.js"></script>
<script language="javascript">
function chk_submit() {
	var oForm = document.operatorForm;
	oForm.cmd.value = "insert";
	return true;
}



</script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
.STYLE3 {color: #000000}
-->
</style>
</head>
<body  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="98%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td >
      <form name="operatorForm" method="post" onSubmit="return chk_submit();">
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
       
      
        <tr> 
          <td height="100" align="center" valign="top" style="padding-top:10px;padding-bottom:10px;">
            <table width="96%" border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
               <tr>
                <td height="24" colspan="2" bgcolor="#EDEDF0" style="padding-left:10px;">
                提示：<font color="red">*</font> 号为必填项，请您认真填写
                </td>
              </tr>
            <%if (!strErr.trim().equals("")) {%>
             
              <tr> 
                <td height="24" colspan="2" bgcolor="#D7D7DB" style="padding-left:10px;">
                  错误提示：<font color=red><%=strErr%></font>                </td>
              </tr>
           <%}%>
              
           
            
            <tr> 
                <td height="24" colspan="2" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>厂商信息</strong></font>                </td>
              </tr>
             
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商名称<span style="padding-right:5px;"><font color="red">*</font></span></td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="comname" type="text" id="comname" value="<%=comname%>" size="25" maxlength="50" class="inputbox">
                </label></td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商电话：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="comtel" type="text" id="comtel" value="<%=comtel%>" size="25" maxlength="20" class="inputbox">
                </label></td>
     		</tr>
     		<tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商地址：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="comaddress" type="text"  size="80" value="<%=comaddress%>"  maxlength="100" class="inputbox">
                </label></td>
              </tr>
              <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商备注：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                <textarea name="comremark" cols="50" rows="4" ><%=comremark%></textarea>
                </label></td>
              </tr>
     		<tr> 
                <td height="24" colspan="2" bgcolor="#858585" style="padding-left:10px;">
                  <font color="#FFFFFF"><strong>厂商销售信息</strong></font>                </td>
              </tr>
     		
                  <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商销售：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="comsalename" type="text"  size="25" value="<%=comsalename%>" maxlength="20" class="inputbox">
                </label></td>
              </tr>
              <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商销售电话：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="comsaletel" type="text"  value="<%=comsaletel%>" size="25" maxlength="20" class="inputbox">
                </label></td>
              </tr>
              <tr>
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">厂商销售E-mail：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                  <input name="comsalemail" type="text"  value="<%=comsalemail%>" size="25" maxlength="50" class="inputbox">
                </label></td>
              </tr>
               <tr> 
                <td height="24" align="right" bgcolor="#D7D7DB" style="padding-right:5px;">备注：</td>
                <td bgcolor="#EDEDF0" style="padding-left:5px;"><label>
                <textarea name="comsaleremark" cols="50" rows="4" ><%=comsaleremark%></textarea>
                </label></td>
              </tr>
              <tr> 
                <td bgcolor="#EDEDF0" colspan="2" align="center">
                  <input type="submit" name="submit" value="添加" class="inputButton"> 
                  <input type="reset" name="reset" value="重 写" class="inputButton">
                  <input type="hidden" name="cmd" value="">                  </td>
              </tr>
            </table>
          </td>
        </tr>
       
      </table>
          </form>
    </td>
  </tr>
</table>


<iframe width="168" height="190" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js"
			src="calendar/ipopeng.htm" scrolling="no" frameborder="0" style="BORDER-RIGHT:2px ridge; BORDER-TOP:2px ridge; Z-INDEX:999; LEFT:-500px; VISIBILITY:visible; BORDER-LEFT:2px ridge; BORDER-BOTTOM:2px ridge; POSITION:absolute; TOP:0px">
		</iframe>


<%if (cmd.equals("insert") && strErr.trim().equals("")){%>
<script language="javascript">
alert("项目登记成功您可以继续添加!");
location.href="company_list.jsp";
</script>
<%}%>
</body>

</html>
